/**
 * $Id$
 *
 * @author Noritaka Horio<holy.shared.design@gmail.com>
 * @copyright 2009 Noritaka Horio all rights resrved. 
 * @license The MIT License
 * @version $Revision$
 * @since
 */

//PDEコンテキスト
var PDEContext = null;

var TimeLisner = function(date, time) {

	//PDEコンテキストからランダムに実行するProcessingソースコードを選択する
	var keys = PDEContext.getKeys();
	var key	 = keys.getRandom();
	var pde  = PDEContext.get(key);

	//Processingソースコードの読み込み
	var loader = new PDE.Loader({
		"basePath": "airapp/pde/",
		"onComplete": function(context) {

			//Processingの実行
			var code	= context.get("code");
			var images	= context.get("images");

			this.processing.run(code, images);
		}.bind(this)
	});

	var title = $("information").getElement("p.title");
	title.set("html", pde.name);

	loader.load(pde.name);
};

var MinuteLisner = function(date, time) {
	var dateTime = $("information").getElement("p.dateTime");
	dateTime.set("html", date + " " + time);
};

var Schedule = new Hash({
	"00:00": TimeLisner, "01:00": TimeLisner,
	"02:00": TimeLisner, "03:00": TimeLisner,
	"04:00": TimeLisner, "05:00": TimeLisner,
	"06:00": TimeLisner, "07:00": TimeLisner,
	"08:00": TimeLisner, "09:00": TimeLisner,
	"10:00": TimeLisner, "11:00": TimeLisner,
	"12:00": TimeLisner, "13:00": TimeLisner,
	"14:00": TimeLisner, "15:00": TimeLisner,
	"16:00": TimeLisner, "17:00": TimeLisner,
	"18:00": TimeLisner, "19:00": TimeLisner,
	"20:00": TimeLisner, "21:00": TimeLisner,
	"22:00": TimeLisner, "23:00": TimeLisner,
	"24:00": TimeLisner
});